package com.ossjk.core.vo;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ossjk.core.vo.ResponseBean.Builder;

import io.swagger.annotations.ApiModelProperty;

public class RequestBean<T> implements Serializable {
	/**
	 * 搜索参数
	 */
    @ApiModelProperty(value = "搜索参数")
	private Map<String, Object> param=new HashedMap();
	/**
	 * 分页参数
	 */
    @ApiModelProperty(value = "分页参数")
	private Page page;
	/**
	 * 业务对象
	 */
    @ApiModelProperty(value = "业务对象")
	private T data;

	public RequestBean() {

	}

	private RequestBean(Builder<T> builder) {
		this.param = builder.param;
		this.page = builder.page;
		this.data = builder.data;
	}

	public static class Builder<T> {
		/**
		 * 搜索参数
		 */
		private Map<String, Object> param;
		/**
		 * 分页参数
		 */
		private Page page;
		/**
		 * 业务对象
		 */
		private T data;

		public Builder param(Map<String, Object> param) {
			this.param = param;
			return this;
		}

		public Builder page(Page page) {
			this.page = page;
			return this;
		}

		public Builder data(T data) {
			this.data = data;
			return this;
		}

		public RequestBean build() {
			return new RequestBean(this);
		}
	}

	public Map<String, Object> getParam() {
		return param;
	}

	public void setParam(Map<String, Object> param) {
		this.param = param;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	@Override
	public String toString() {
		return "RequestBean [param=" + param + ", page=" + page + ", data=" + data + "]";
	}

}
